/*
 * ESPRSSIF MIT License
 *
 * Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
 *
 * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP32 only, in which case,
 * it is free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
 * to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or
 * substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */

#ifndef _APP_DPORT_REG_H
#define _APP_DPORT_REG_H

#define APP_CPU_PER_CONF_REG (DR_REG_APPDPORT_BASE + 0x00)
#define APPDPORT_CPUPERIOD_SEL (BIT(0))
#define APPDPORT_CPUPERIOD_SEL_S 0

#define APP_INTR_STATUS_REG_0 (DR_REG_APPDPORT_BASE + 0x04)
#define APPDPORT_INTR_STATUS_0 0xFFFFFFFF
#define APPDPORT_INTR_STATUS_0_S 0

#define APP_INTR_STATUS_REG_1 (DR_REG_APPDPORT_BASE + 0x08)
#define APPDPORT_INTR_STATUS_1 0xFFFFFFFF
#define APPDPORT_INTR_STATUS_1_S 0

#define APP_INTR_MAP_REG_A (DR_REG_APPDPORT_BASE + 0x0C)
#define APPDPORT_INTR_MAP_5 0x0000001F
#define APPDPORT_INTR_MAP_5_S 26
#define APPDPORT_INTR_MAP_4 0x0000001F
#define APPDPORT_INTR_MAP_4_S 21
#define APPDPORT_INTR_MAP_3 0x0000001F
#define APPDPORT_INTR_MAP_3_S 16
#define APPDPORT_INTR_MAP_2 0x0000001F
#define APPDPORT_INTR_MAP_2_S 10
#define APPDPORT_INTR_MAP_1 0x0000001F
#define APPDPORT_INTR_MAP_1_S 5
#define APPDPORT_INTR_MAP_0 0x0000001F
#define APPDPORT_INTR_MAP_0_S 0

#define APP_INTR_MAP_REG_B (DR_REG_APPDPORT_BASE + 0x10)
#define APPDPORT_INTR_MAP_11 0x0000001F
#define APPDPORT_INTR_MAP_11_S 26
#define APPDPORT_INTR_MAP_10 0x0000001F
#define APPDPORT_INTR_MAP_10_S 21
#define APPDPORT_INTR_MAP_9 0x0000001F
#define APPDPORT_INTR_MAP_9_S 16
#define APPDPORT_INTR_MAP_8 0x0000001F
#define APPDPORT_INTR_MAP_8_S 10
#define APPDPORT_INTR_MAP_7 0x0000001F
#define APPDPORT_INTR_MAP_7_S 5
#define APPDPORT_INTR_MAP_6 0x0000001F
#define APPDPORT_INTR_MAP_6_S 0

#define APP_INTR_MAP_REG_C (DR_REG_APPDPORT_BASE + 0x14)
#define APPDPORT_INTR_MAP_17 0x0000001F
#define APPDPORT_INTR_MAP_17_S 26
#define APPDPORT_INTR_MAP_16 0x0000001F
#define APPDPORT_INTR_MAP_16_S 21
#define APPDPORT_INTR_MAP_15 0x0000001F
#define APPDPORT_INTR_MAP_15_S 16
#define APPDPORT_INTR_MAP_14 0x0000001F
#define APPDPORT_INTR_MAP_14_S 10
#define APPDPORT_INTR_MAP_13 0x0000001F
#define APPDPORT_INTR_MAP_13_S 5
#define APPDPORT_INTR_MAP_12 0x0000001F
#define APPDPORT_INTR_MAP_12_S 0

#define APP_INTR_MAP_REG_D (DR_REG_APPDPORT_BASE + 0x18)
#define APPDPORT_INTR_MAP_23 0x0000001F
#define APPDPORT_INTR_MAP_23_S 26
#define APPDPORT_INTR_MAP_22 0x0000001F
#define APPDPORT_INTR_MAP_22_S 21
#define APPDPORT_INTR_MAP_21 0x0000001F
#define APPDPORT_INTR_MAP_21_S 16
#define APPDPORT_INTR_MAP_20 0x0000001F
#define APPDPORT_INTR_MAP_20_S 10
#define APPDPORT_INTR_MAP_19 0x0000001F
#define APPDPORT_INTR_MAP_19_S 5
#define APPDPORT_INTR_MAP_18 0x0000001F
#define APPDPORT_INTR_MAP_18_S 0

#define APP_INTR_MAP_REG_E (DR_REG_APPDPORT_BASE + 0x1C)
#define APPDPORT_INTR_MAP_29 0x0000001F
#define APPDPORT_INTR_MAP_29_S 26
#define APPDPORT_INTR_MAP_28 0x0000001F
#define APPDPORT_INTR_MAP_28_S 21
#define APPDPORT_INTR_MAP_27 0x0000001F
#define APPDPORT_INTR_MAP_27_S 16
#define APPDPORT_INTR_MAP_26 0x0000001F
#define APPDPORT_INTR_MAP_26_S 10
#define APPDPORT_INTR_MAP_25 0x0000001F
#define APPDPORT_INTR_MAP_25_S 5
#define APPDPORT_INTR_MAP_24 0x0000001F
#define APPDPORT_INTR_MAP_24_S 0

#define APP_INTR_MAP_REG_F (DR_REG_APPDPORT_BASE + 0x20)
#define APPDPORT_INTR_MAP_35 0x0000001F
#define APPDPORT_INTR_MAP_35_S 26
#define APPDPORT_INTR_MAP_34 0x0000001F
#define APPDPORT_INTR_MAP_34_S 21
#define APPDPORT_INTR_MAP_33 0x0000001F
#define APPDPORT_INTR_MAP_33_S 16
#define APPDPORT_INTR_MAP_32 0x0000001F
#define APPDPORT_INTR_MAP_32_S 10
#define APPDPORT_INTR_MAP_31 0x0000001F
#define APPDPORT_INTR_MAP_31_S 5
#define APPDPORT_INTR_MAP_30 0x0000001F
#define APPDPORT_INTR_MAP_30_S 0

#define APP_INTR_MAP_REG_G (DR_REG_APPDPORT_BASE + 0x24)
#define APPDPORT_INTR_MAP_41 0x0000001F
#define APPDPORT_INTR_MAP_41_S 26
#define APPDPORT_INTR_MAP_40 0x0000001F
#define APPDPORT_INTR_MAP_40_S 21
#define APPDPORT_INTR_MAP_39 0x0000001F
#define APPDPORT_INTR_MAP_39_S 16
#define APPDPORT_INTR_MAP_38 0x0000001F
#define APPDPORT_INTR_MAP_38_S 10
#define APPDPORT_INTR_MAP_37 0x0000001F
#define APPDPORT_INTR_MAP_37_S 5
#define APPDPORT_INTR_MAP_36 0x0000001F
#define APPDPORT_INTR_MAP_36_S 0

#define APP_INTR_MAP_REG_H (DR_REG_APPDPORT_BASE + 0x28)
#define APPDPORT_INTR_MAP_43 0x0000001F
#define APPDPORT_INTR_MAP_43_S 5
#define APPDPORT_INTR_MAP_42 0x0000001F
#define APPDPORT_INTR_MAP_42_S 0

#define APP_CACHE_CTRL_REG (DR_REG_APPDPORT_BASE + 0x30)
#define APPDPORT_SLAVE_REQ (BIT(27))
#define APPDPORT_SLAVE_REQ_S 27
#define APPDPORT_AHB_SPI_REQ (BIT(26))
#define APPDPORT_AHB_SPI_REQ_S 26
#define APPDPORT_APP_SLAVE_REQ (BIT(25))
#define APPDPORT_APP_SLAVE_REQ_S 25
#define APPDPORT_APP_AHB_SPI_REQ (BIT(24))
#define APPDPORT_APP_AHB_SPI_REQ_S 24
#define APPDPORT_APP_CACHE_SEGM_DROM0_SEL 0x0000000F
#define APPDPORT_APP_CACHE_SEGM_DROM0_SEL_S 20
#define APPDPORT_APP_CACHE_SEGM_IRAM0_SEL 0x0000000F
#define APPDPORT_APP_CACHE_SEGM_IRAM0_SEL_S 16
#define APPDPORT_APP_FLASH_SEGMENT_DROM0_SEL 0x00000003
#define APPDPORT_APP_FLASH_SEGMENT_DROM0_SEL_S 14
#define APPDPORT_APP_FLASH_SEGMENT_IRAM0_SEL 0x00000003
#define APPDPORT_APP_FLASH_SEGMENT_IRAM0_SEL_S 12
#define APPDPORT_APP_CACHE_SEGM_DROM0_EN (BIT(11))
#define APPDPORT_APP_CACHE_SEGM_DROM0_EN_S 11
#define APPDPORT_APP_CACHE_SEGM_IRAM0_EN (BIT(10))
#define APPDPORT_APP_CACHE_SEGM_IRAM0_EN_S 10
#define APPDPORT_APP_CACHE_MASK_DROM0 (BIT(9))
#define APPDPORT_APP_CACHE_MASK_DROM0_S 9
#define APPDPORT_APP_CACHE_MASK_IRAM0 (BIT(8))
#define APPDPORT_APP_CACHE_MASK_IRAM0_S 8
#define APPDPORT_APP_CACHE_LOCK_1_EN (BIT(7))
#define APPDPORT_APP_CACHE_LOCK_1_EN_S 7
#define APPDPORT_APP_CACHE_LOCK_0_EN (BIT(6))
#define APPDPORT_APP_CACHE_LOCK_0_EN_S 6
#define APPDPORT_APP_CACHE_FLUSH_DONE (BIT(5))
#define APPDPORT_APP_CACHE_FLUSH_DONE_S 5
#define APPDPORT_APP_CACHE_FLUSH_ENA (BIT(4))
#define APPDPORT_APP_CACHE_FLUSH_ENA_S 4
#define APPDPORT_APP_CACHE_ENABLE (BIT(3))
#define APPDPORT_APP_CACHE_ENABLE_S 3
#define APPDPORT_APP_WAY_SEL (BIT(2))
#define APPDPORT_APP_WAY_SEL_S 2
#define APPDPORT_APP_IRAM1_CACHE_ENA 0x00000003
#define APPDPORT_APP_IRAM1_CACHE_ENA_S 0

#define APP_CACHE_LOCK_0_ADDR_REG (DR_REG_APPDPORT_BASE + 0x34)
#define APPDPORT_APP_CACHE_LOCK_0_ADDR_MAX 0x0000000F
#define APPDPORT_APP_CACHE_LOCK_0_ADDR_MAX_S 20
#define APPDPORT_APP_CACHE_LOCK_0_ADDR_MIN 0x0000000F
#define APPDPORT_APP_CACHE_LOCK_0_ADDR_MIN_S 16
#define APPDPORT_APP_CACHE_LOCK_0_ADDR_PRE 0x000003FF
#define APPDPORT_APP_CACHE_LOCK_0_ADDR_PRE_S 0

#define APP_CACHE_LOCK_1_ADDR_REG (DR_REG_APPDPORT_BASE + 0x38)
#define APPDPORT_APP_CACHE_LOCK_1_ADDR_MAX 0x0000000F
#define APPDPORT_APP_CACHE_LOCK_1_ADDR_MAX_S 20
#define APPDPORT_APP_CACHE_LOCK_1_ADDR_MIN 0x0000000F
#define APPDPORT_APP_CACHE_LOCK_1_ADDR_MIN_S 16
#define APPDPORT_APP_CACHE_LOCK_1_ADDR_PRE 0x000003FF
#define APPDPORT_APP_CACHE_LOCK_1_ADDR_PRE_S 0

#define APP_BOOT_REMAP_CTRL_REG (DR_REG_APPDPORT_BASE + 0x40)
#define APPDPORT_INIT_BOOT_REMAP (BIT(8))
#define APPDPORT_INIT_BOOT_REMAP_S 8
#define APPDPORT_APP_BOOT_REMAP_FRC 0x00000003
#define APPDPORT_APP_BOOT_REMAP_FRC_S 0

#define APP_BOOT_ADDR_REG (DR_REG_APPDPORT_BASE + 0x44)
#define APPDPORT_BOOT_ADDR 0xFFFFFFFF
#define APPDPORT_BOOT_ADDR_S 0

#define APP_DPORT_APB_MASK0 (DR_REG_APPDPORT_BASE + 0x48)
#define APPDPORT_APPDPORT_APB_MASK0 0xFFFFFFFF
#define APPDPORT_APPDPORT_APB_MASK0_S 0

#define APP_DPORT_APB_MASK1 (DR_REG_APPDPORT_BASE + 0x4C)
#define APPDPORT_APPDPORT_APB_MASK1 0xFFFFFFFF
#define APPDPORT_APPDPORT_APB_MASK1_S 0

#define APP_CACHE_MAP_A (DR_REG_APPDPORT_BASE + 0x50)
#define APPDPORT_APPCACHE_MAP4 0x0000003F
#define APPDPORT_APPCACHE_MAP4_S 24
#define APPDPORT_APPCACHE_MAP3 0x0000003F
#define APPDPORT_APPCACHE_MAP3_S 18
#define APPDPORT_APPCACHE_MAP2 0x0000003F
#define APPDPORT_APPCACHE_MAP2_S 12
#define APPDPORT_APPCACHE_MAP1 0x0000003F
#define APPDPORT_APPCACHE_MAP1_S 6
#define APPDPORT_APPCACHE_MAP0 0x0000003F
#define APPDPORT_APPCACHE_MAP0_S 0

#define APP_CACHE_MAP_B (DR_REG_APPDPORT_BASE + 0x54)
#define APPDPORT_APPCACHE_MAP9 0x0000003F
#define APPDPORT_APPCACHE_MAP9_S 24
#define APPDPORT_APPCACHE_MAP8 0x0000003F
#define APPDPORT_APPCACHE_MAP8_S 18
#define APPDPORT_APPCACHE_MAP7 0x0000003F
#define APPDPORT_APPCACHE_MAP7_S 12
#define APPDPORT_APPCACHE_MAP6 0x0000003F
#define APPDPORT_APPCACHE_MAP6_S 6
#define APPDPORT_APPCACHE_MAP5 0x0000003F
#define APPDPORT_APPCACHE_MAP5_S 0

#define APP_CACHE_MAP_C (DR_REG_APPDPORT_BASE + 0x58)
#define APPDPORT_APPCACHE_MAP14 0x0000003F
#define APPDPORT_APPCACHE_MAP14_S 24
#define APPDPORT_APPCACHE_MAP13 0x0000003F
#define APPDPORT_APPCACHE_MAP13_S 18
#define APPDPORT_APPCACHE_MAP12 0x0000003F
#define APPDPORT_APPCACHE_MAP12_S 12
#define APPDPORT_APPCACHE_MAP11 0x0000003F
#define APPDPORT_APPCACHE_MAP11_S 6
#define APPDPORT_APPCACHE_MAP10 0x0000003F
#define APPDPORT_APPCACHE_MAP10_S 0

#define APP_CACHE_MAP_D (DR_REG_APPDPORT_BASE + 0x5C)
#define APPDPORT_APPCACHE_MAP15 0x0000003F
#define APPDPORT_APPCACHE_MAP15_S 0

#define APP_DPROT_REG_DATE (DR_REG_APPDPORT_BASE + 0xFC)
#define APPDPORT_APP_DPORT_DATE 0x0FFFFFFF
#define APPDPORT_APP_DPORT_DATE_S 0
#define APPDPORT_APP_DPORT_DATE_VERSION 0x1506110

#endif
